local wanweizhihai = fk.CreateSkill {
    name = "wanweizhihai",
    tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["wanweizhihai"] = "智海",
  [":wanweizhihai"] = "锁定技，当梦之队角色受到伤害时，你可以替其承受该伤害",

  ["#wanweizhihai-ask"] = "智海：你可以将 %dest 受到的伤害转移给你",
}

wanweizhihai:addEffect(fk.DamageInflicted, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return
      player:hasSkill(wanweizhihai.name) and
      target ~= player and
      player:isAlive() and
      target.kingdom == "dream"
  end,
    on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player, self.name, "#wanweizhihai-ask", true)
  end,
  on_use = function(self, event, target, player, data)
    local skillName = wanweizhihai.name
    local room = player.room
    room:doIndicate(player, { target })
    local damage = data.damage
    data:preventDamage()
    if player:isAlive() then
      room:damage{
        from = data.from,
        to = player,
        damage = damage,
        damageType = data.damageType,
        skillName = skillName,
        card = data.card,
      }
    end
  end,
})

return wanweizhihai
